<template>
    <div style="text-align: center;margin: auto;">

        <h1 style="text-align: center;margin-top: 90px;">请选择床位</h1>
        <div>
            <hr>
            <div>
                <input v-for="item in table" v-show="item.name != null" type="button"
                    :value="item.bedCode + ` ` + item.name" style="margin: 20px;width: 100px; height: 50px;"
                    @click="AddPorterWork(item)" :disabled="false">
            </div>
            <br>
            <div>
                <input v-for="item in table" v-show="item.name == null" type="button" :value="item.bedCode + ` ` + `暂无`"
                    style="margin: 20px;width: 100px; height: 50px;" :disabled="true">
            </div>

        </div>
    </div>
</template>

<script lang="ts" setup>
import http from '@/api/http';
import { axiosHelpers } from '@/http/axiosHelpers';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();

onMounted(() => {
    showbutton()
})

const table: any = ref([])
const showbutton = () => {
    http.get(`/api/NurseManageController/ShowPatient`)
        .then(res => {
            table.value = res.data
        })
}

const AddPorterWork = (item: any) => {
    router.push({
        path: '/AddPorterWork',
        query: {
            item: JSON.stringify(item)
        }
    })
}

</script>